Optimal. Leaf size=101 \[ -\frac {\sqrt {a} \tanh ^{-1}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {2} \sqrt {a+a \sin (e+f x)}}\right )}{\sqrt {2} f}+\frac {5 \sec (e+f x) \sqrt {a+a \sin (e+f x)}}{f}-\frac {2 \sec (e+f x) (a+a \sin (e+f x))^{3/2}}{a f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 101, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {2792, 2934,
2728, 212} \begin {gather*} -\frac {2 \sec (e+f x) (a \sin (e+f x)+a)^{3/2}}{a f}+\frac {5 \sec (e+f x) \sqrt {a \sin (e+f x)+a}}{f}-\frac {\sqrt {a} \tanh ^{-1}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {2} \sqrt {a \sin (e+f x)+a}}\right )}{\sqrt {2} f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 2728
Rule 2792
Rule 2934
Rubi steps
\begin {align*} \int \sqrt {a+a \sin (e+f x)} \tan ^2(e+f x) \, dx &=-\frac {2 \sec (e+f x) (a+a \sin (e+f x))^{3/2}}{a f}+\frac {2 \int \sec ^2(e+f x) \sqrt {a+a \sin (e+f x)} \left (\frac {3 a}{2}+a \sin (e+f x)\right ) \, dx}{a}\\ &=\frac {5 \sec (e+f x) \sqrt {a+a \sin (e+f x)}}{f}-\frac {2 \sec (e+f x) (a+a \sin (e+f x))^{3/2}}{a f}+\frac {1}{2} a \int \frac {1}{\sqrt {a+a \sin (e+f x)}} \, dx\\ &=\frac {5 \sec (e+f x) \sqrt {a+a \sin (e+f x)}}{f}-\frac {2 \sec (e+f x) (a+a \sin (e+f x))^{3/2}}{a f}-\frac {a \text {Subst}\left (\int \frac {1}{2 a-x^2} \, dx,x,\frac {a \cos (e+f x)}{\sqrt {a+a \sin (e+f x)}}\right )}{f}\\ &=-\frac {\sqrt {a} \tanh ^{-1}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {2} \sqrt {a+a \sin (e+f x)}}\right )}{\sqrt {2} f}+\frac {5 \sec (e+f x) \sqrt {a+a \sin (e+f x)}}{f}-\frac {2 \sec (e+f x) (a+a \sin (e+f x))^{3/2}}{a f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.23, size = 114, normalized size = 1.13 \begin {gather*} \frac {\sec (e+f x) \left (3+(1-i) \sqrt [4]{-1} \tanh ^{-1}\left (\left (\frac {1}{2}+\frac {i}{2}\right ) (-1)^{3/4} \sec \left (\frac {f x}{4}\right ) \left (\cos \left (\frac {1}{4} (2 e+f x)\right )-\sin \left (\frac {1}{4} (2 e+f x)\right )\right )\right ) \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )-2 \sin (e+f x)\right ) \sqrt {a (1+\sin (e+f x))}}{f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 2.15, size = 89, normalized size = 0.88
method | result | size |
default | \(-\frac {\left (1+\sin \left (f x +e \right )\right ) \left (\sqrt {a}\, \sqrt {2}\, \arctanh \left (\frac {\sqrt {a -a \sin \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {a}}\right ) \sqrt {a -a \sin \left (f x +e \right )}+4 a \sin \left (f x +e \right )-6 a \right )}{2 \cos \left (f x +e \right ) \sqrt {a +a \sin \left (f x +e \right )}\, f}\) | \(89\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.39, size = 184, normalized size = 1.82 \begin {gather*} \frac {\sqrt {2} \sqrt {a} \cos \left (f x + e\right ) \log \left (-\frac {a \cos \left (f x + e\right )^{2} - 2 \, \sqrt {2} \sqrt {a \sin \left (f x + e\right ) + a} \sqrt {a} {\left (\cos \left (f x + e\right ) - \sin \left (f x + e\right ) + 1\right )} + 3 \, a \cos \left (f x + e\right ) - {\left (a \cos \left (f x + e\right ) - 2 \, a\right )} \sin \left (f x + e\right ) + 2 \, a}{\cos \left (f x + e\right )^{2} - {\left (\cos \left (f x + e\right ) + 2\right )} \sin \left (f x + e\right ) - \cos \left (f x + e\right ) - 2}\right ) - 4 \, \sqrt {a \sin \left (f x + e\right ) + a} {\left (2 \, \sin \left (f x + e\right ) - 3\right )}}{4 \, f \cos \left (f x + e\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \sqrt {a \left (\sin {\left (e + f x \right )} + 1\right )} \tan ^{2}{\left (e + f x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 455 vs.
\(2 (94) = 188\).
time = 10.71, size = 455, normalized size = 4.50 \begin {gather*} \frac {\sqrt {2} {\left (\log \left (\frac {2 \, {\left (\tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )^{2} + 2 \, \tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right ) + 1\right )}}{\tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )^{2} + 1}\right ) \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) \tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )^{3} - \log \left (\frac {2 \, {\left (\tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )^{2} - 2 \, \tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right ) + 1\right )}}{\tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )^{2} + 1}\right ) \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) \tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )^{3} - \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) \tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )^{4} + \log \left (\frac {2 \, {\left (\tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )^{2} + 2 \, \tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right ) + 1\right )}}{\tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )^{2} + 1}\right ) \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) \tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right ) - \log \left (\frac {2 \, {\left (\tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )^{2} - 2 \, \tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right ) + 1\right )}}{\tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )^{2} + 1}\right ) \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) \tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right ) - 18 \, \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right ) \tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )^{2} - \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )\right )} \sqrt {a}}{4 \, {\left (\tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )^{3} + \tan \left (-\frac {1}{8} \, \pi + \frac {1}{4} \, f x + \frac {1}{4} \, e\right )\right )} f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\mathrm {tan}\left (e+f\,x\right )}^2\,\sqrt {a+a\,\sin \left (e+f\,x\right )} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________